"auto";

// swipe(520,1700 ,520 ,240 ,1000 );
// sleep(2000);
// swipe(520,1700 ,520 ,240 ,1000 );
// sleep(2000);
// swipe(520,1700 ,520 ,240 ,1000 );
// sleep(2000);
for (i = 0; i < 20; i++) {

    let myobject = id("iv_follow").find();
    if (!myobject.empty()) {
        log("找到目标");
        myobject.forEach(
            function(currentValue, index) {
            
                if ( currentValue!= null) {
                    // 点击列表项
                    currentValue.click();
                    sleep(4000);
                    let object = text("关注成功").findOnce();
                    //log(object);
                    if (object != null) {
                        click(500, 1280);
                        toast("关注成功");
                        
                    } else {
                        toast("已经关注过啦");
                    //log()
                    }
                }
                sleep(2000);
            }

        );


    } else {
        log("没找到╭(╯^╰)╮");
    };

    toast("开始下一页");
    sleep(2000);
    swipe(520,1920 ,520 ,0,1500 );
    sleep(2000);

}

